package tex.base;

import java.util.Vector;

 /*
  * Coisas do tipo \name{env1}[options]{env2}
  */
public class Definition implements Element {
	private String name;
	private final Vector<String> options;
	private final Vector<Enviroment> enviroments;
	
	
	public Definition() {
		options = new Vector<String>();
		enviroments = new Vector<Enviroment>();
	}


	/**
	 * @return the options
	 */
	public Vector<String> getOptions() {
		return options;
	}


	/**
	 * @return the enviroments
	 */
	public Vector<Enviroment> getEnviroments() {
		return enviroments;
	}


	/**
	 * @param name the name to set
	 */
	public void setName(String name) {
		this.name = name;
	}


	/**
	 * @return the name
	 */
	public String getName() {
		return name;
	}
	
	@Override
	public String toString() {
		return "{ def: (nome " + name + ")\n(opt " + options + ")\n(envs: " + enviroments + ")}";
	}


	@Override
	public void generateDocument(StringBuffer buffer, Tex tex) {
		if (!enviroments.isEmpty())
			enviroments.lastElement().generateDocument(buffer, tex);
	}
}
